package com.cskaoyan.dbutils;

import com.cskaoyan.datasource.opensource.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapHandler;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 创建日期: 2022/06/05 17:36
 *
 * @author ciggar
 *
 * MapHandler
 */
public class DBUtilsDemo8 {


    public static void main(String[] args) throws SQLException {

        // 创建一个QueryRunner ， 传入数据库连接池
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Map<String,Object>> mapList = queryRunner.query("select * from cskaoyan",
                new MapListHandler());

        System.out.println(mapList);
    }
}
